#coding=utf-8
'''
Created on 2017-7-13

@author: sandy
'''

import logging
import Utils,Const
import Pack as packet

def cmdKeepAlive(logserver,pkt):
    logging.debug("LogServer->XXXX keepAlive")
    pass

def cmdLoginRet(logserver,pkt):
    ecode = packet.unpack("H", pkt)
    if ecode != Const.ERR_OK:
        logging.info(u'Login LogServer Failed ecode=%d', ecode)
    else:
        logging.info(u'Login LogServer Sucess ecode=%d', ecode)
    pass

__cmdTable = {
              Const.CMD_KEEP_ALIVE            : cmdKeepAlive,
              Const.CMD_LOG2XX_LOGIN          : cmdLoginRet, 
              
             }
def parse(logserver,cmd,pkt):
    if cmd == Const.CMD_KEEP_ALIVE:
        return
    logging.debug(u"LogServerParse cmd = %d",cmd)
    func = __cmdTable.get(cmd)
    if not func :
        logging.debug(u"unknow cmd=%d" % cmd)
        return
    func(logserver, pkt)